const minimist = require('minimist');
const execa = require('execa');
// 解析命令行参数
const args = minimist(process.argv.slice(2));
const target = args._.length ? args._[0] : 'runtime-dom';
const format = args.f ? args.f.join('-') : 'global';
const sourcemap = args.s || false;

console.log(target, format, sourcemap);

execa('rollup', [ 
    '-wc', // --watch --config
    '--environment',
    [
        `TARGET:${target}`,
        `FORMATS:${format}`,
        sourcemap ? 'SOURCEMAP:true' : ''
    ].filter(Boolean).join(','), 
 ],{
    stdio: 'inherit', //继承父进程的输出
 })
